package org.ricks.ioc.scheduler;

/**
 * 固定速率的延迟触发器.
 */
public class FixedRateTrigger extends DelayTrigger {

    private final long period;

    public FixedRateTrigger(long initialDelay, long period) {
        super(System.currentTimeMillis() + initialDelay);
        this.period =  period;
    }

    @Override
    public long triggerTime() {
        trigger += period; // 基于上次时间递增
        return trigger;
    }

}
